package com.javasm.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：MoDebing
 * @Version：1.0
 * @Date：2022-09-04-23:14
 * @Description:
 */
@RestController
@RequestMapping("/user")
public class UserController {

    /**
     * 获取当前用户信息
     *
     * @return
     */
    @RequestMapping("/getCurrentUser")

    public Object getCurrentUser(){
        // 获取用户授权信息
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return authentication;
    }


    @RequestMapping("/test")
    public String test(){
        return "test";
    }
}
